<?php	
		session_start();
		if (!isset($_GET['url']) || !isset($_GET['token'])) die('Need url and token');

		$ch = curl_init();  

		curl_setopt($ch, CURLOPT_URL, urldecode($_GET['url']));
		curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
		curl_setopt($ch, CURLOPT_HEADER, false);   
		curl_setopt($ch, CURLOPT_HTTPHEADER, array(
		    'Authorization: Bearer '. $_GET['token'],
		    'Access-Control-Allow-Origin: *',
		    ));

		$output = curl_exec($ch);
		$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
		if($httpCode == 200) {
    		$_SESSION['GoogleToken'] = $_GET['token'];
		}
		else
		{
			$_SESSION['GoogleToken'] = false;
			header("HTTP/1.0 " . $httpCode);
		}
		if($errno = curl_errno($ch)) {
		    echo "cURL error ({$errno})";
		}

		curl_close($ch);
		echo $output;
?>